<template>
	<view class="container">
		<view class="line"></view>
		<view class="list u-m-20">
			<view class="item u-border-bottom" v-for="(item,index) in list" :key="index">
				<view class="label">{{item.label}}</view>
				<view class="input u-flex u-row-center">
				<u-input		
					v-model="model[item['name']]"
					type="number"
					maxlength="2"
					placeholder=""
				></u-input>%
				</view>
			</view>
		</view>
		<button class="btn" @click="submit">确定</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				row:{},
				model:{
					enterpriseNature:0,
					qylx:0,
					qualification:0,
					enterpriseField:0,
					qualitySystem:0,
					scale:0,
					area:0
				},
				list: [{
					label: '企业性质',
					value: false,
					name: 'enterpriseNature'
				},{
					label: '企业类型',
					value: false,
					name: 'qylx'
				}, {
					label: '资质证书',
					value: false,
					name: 'qualification'
				}, {
					label: '擅长领域',
					value: false,
					name: 'enterpriseField'
				}, {
					label: '质量体系',
					value: false,
					name: 'qualitySystem'
				}, {
					label: '人员规模',
					value: false,
					name: 'scale'
				}, {
					label: '企业地域',
					value: false,
					name: 'area'
				}]
			};
		},		
		onLoad(opt) {
			console.log(opt);
			let row = JSON.parse(decodeURIComponent(opt.row));
			let type = JSON.parse(decodeURIComponent(opt.type));
			console.log('row',row)
			if(row){
				this.row = row;
				console.log(row.weight);
				if(row.weight != undefined){
					this.model = row.weight;
				}
			}
			if(type){
				this.url = type;
			}
		},
		methods: {
			submit(){
				console.log(this.model);
				this.row.weight = this.model;
				var row = encodeURIComponent(JSON.stringify(this.row));
				if(this.url != ''){
					uni.redirectTo({
						url: '../'+this.url+'?row=' + row
					})
				}else{
					uni.redirectTo({
						url: '../user/myCompanyPage?row=' + row
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100%;
		background-color: #F5F5F9;

		.list {
			background-color: #fff;
			border-radius: 10rpx;
			.item {
				width: 100%;
				display: flex;
				height: 100upx;
				align-items: center;
				justify-content: space-between;
				padding: 0 30upx;

				.text {
					color: #9DA2B0;
					font-size: 26upx;
				}

				.label {
					color: #0D1D36;
					font-size: 30upx;
				}
				.input {
					padding:0 10rpx;
					width:110rpx;
					height:38rpx;					
					border: 1px solid #A0A0A0;
					border-radius: 6rpx;
				}
			}
		}

		.line {
			width: 100%;
			height: 20upx;
			background: #F5F5F9;
		}
	}
	.btn {
		width: 662rpx;
		height: 80rpx;
		margin:110rpx auto 100rpx auto;
		line-height: 80rpx;
		background: #AB61FF;
		border-radius: 40rpx;		
		font-size: 32rpx;
		color: #FFFFFF;
	}
</style>
